import unittest
from webtest import TestApp,TestResponse
from google.appengine.ext import webapp
from Controller.LogInController import LogInController
from Controller.LogOutController import LogOutController

class LogInTest(unittest.TestCase):

  def setUp(self):
      webapp.WSGIApplication([('/logout', LogOutController)], debug=True)
      self.application = webapp.WSGIApplication([('/login', LogInController)], debug=True)

  def test_default_page(self):
      app = TestApp(self.application)
      response = app.get('/login')
      self.assertEqual('200 OK', response.status)
      self.assertTrue('Sign in to manage' in response.body)

  def test_page_with_param(self):
      app = TestApp(self.application)
      response = app.post('/login?name=test&Password=admin&OrgName=companyname')
      self.assertEqual('200 OK', response.status)
